home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_12 / Mission.script < prev    next >
Text File  |  2001-12-19  |  8KB  |  254 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. class CEliminatePartisansMission extends
  11.   CBaseMission, CEliminatePartisansMissionObjectList, CEliminatePartisansMission_Strings,
  12.   CNavPointUser
  13. {
  14.   int GetAutoGeneratedUnitsQty()
  15.   {
  16.     return 6;
  17.   }
  18.  
  19.   void CEliminatePartisansMission()
  20.   {
  21.     BaseMission_InitMission();
  22.  
  23.     BaseMission_UpdateLoadProgress();
  24.     CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
  25.     SetComponentPosition("DebugCamera",
  26.       matrix(
  27.         1.0, 0.0, 0.0, 3802.0,
  28.         0.0, 1.0, 0.0, 6865.0,
  29.         0.0, 0.0, 1.0,  300.0,
  30.         0.0, 0.0, 0.0,    1.0
  31.       ));
  32.  
  33.     // CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
  34.     BaseMission_UpdateLoadProgress();
  35.     CreateComponent("Atmosphere", "Atmosphere", "CEliminatePartisansMission_Atmosphere");
  36.  
  37.     BaseMission_UpdateLoadProgress();
  38.     CreateComponent("Sky", "SkyObject", "CEliminatePartisansMission_Sky");
  39.  
  40.     BaseMission_UpdateLoadProgress();
  41.     CreateComponent("Terrain", "ProgressiveTerrainObject", "CEliminatePartisansMission_Terrain");
  42.  
  43.     BaseMission_UpdateLoadProgress();
  44.     CreateComponent("Forest", "Forest", "CEliminatePartisansMission_Forest");
  45.  
  46.     BaseMission_UpdateLoadProgress();
  47.     CreateComponent( "AIController", "AIController", "CMission12_AIController");
  48.  
  49.     BaseMission_CreateObjects();
  50.  
  51.    // Soviet Offensive ranking
  52.    SetBehaviorGroupRank( "12_SovietTank_01", "SovietOffensive_Rank", 1);
  53.    SetBehaviorGroupRank( "12_SovietTank_02", "SovietOffensive_Rank", 2);
  54.    SetBehaviorGroupRank( "12_SovietTank_03", "SovietOffensive_Rank", 3);
  55.    SetBehaviorGroupRank( "12_SovietTank_04", "SovietOffensive_Rank", 4);
  56.    SetBehaviorGroupRank( "12_SovietTank_05", "SovietOffensive_Rank", 5);
  57.    SetBehaviorGroupRank( "12_SovietTank_06", "SovietOffensive_Rank", 6);
  58.    SetBehaviorGroupRank( "12_SovietKatusha_01", "SovietOffensive_Rank", 7);
  59.    SetBehaviorGroupRank( "12_SovietKatusha_02", "SovietOffensive_Rank", 8);
  60.    SetBehaviorGroupRank( "12_SovietKatusha_03", "SovietOffensive_Rank", 9);
  61.    SetBehaviorGroupRank( "12_SovietKatusha_04", "SovietOffensive_Rank", 10);
  62.    SetBehaviorGroupRank( "12_SovietTank_07", "SovietOffensive_Rank", 11);
  63.    SetBehaviorGroupRank( "12_SovietTank_08", "SovietOffensive_Rank", 12);
  64.    // Soviet Offensive ranking
  65.    SetBehaviorGroupRank( "12_SovietAmmo_01", "SovietAmmo_Rank", 1);
  66.    SetBehaviorGroupRank( "12_SovietAmmo_02", "SovietAmmo_Rank", 2);
  67.    SetBehaviorGroupRank( "12_SovietAmmo_03", "SovietAmmo_Rank", 3);
  68.    SetBehaviorGroupRank( "12_SovietAmmo_04", "SovietAmmo_Rank", 4);
  69.    SetBehaviorGroupRank( "12_SovietAmmo_05", "SovietAmmo_Rank", 5);
  70.    SetBehaviorGroupRank( "12_SovietAmmo_06", "SovietAmmo_Rank", 6);
  71.    SetBehaviorGroupRank( "12_SovietAmmo_07", "SovietAmmo_Rank", 7);
  72.    SetBehaviorGroupRank( "12_SovietAmmo_08", "SovietAmmo_Rank", 8);
  73.    SetBehaviorGroupRank( "12_SovietAmmo_09", "SovietAmmo_Rank", 9);
  74.    SetBehaviorGroupRank( "12_SovietAmmo_10", "SovietAmmo_Rank", 10);
  75.    // AA01_Rank ranking
  76.    SetBehaviorGroupRank( "12_GermanAA01_01", "AA01_Rank", 1);
  77.    SetBehaviorGroupRank( "12_GermanAA01_02", "AA01_Rank", 2);
  78.    SetBehaviorGroupRank( "12_GermanAA01_03", "AA01_Rank", 3);
  79.    SetBehaviorGroupRank( "12_GermanAA01_04", "AA01_Rank", 4);
  80.    // AA02_Rank ranking
  81.    SetBehaviorGroupRank( "12_GermanAA02_01", "AA02_Rank", 1);
  82.    SetBehaviorGroupRank( "12_GermanAA02_02", "AA02_Rank", 2);
  83.    SetBehaviorGroupRank( "12_GermanAA02_03", "AA02_Rank", 3);
  84.    SetBehaviorGroupRank( "12_GermanAA02_04", "AA02_Rank", 4);
  85.   }
  86.  
  87.   //  'virtual' methods
  88.  
  89.   //  Objectives
  90.  
  91.   array m_MissionObjectivesStatuses =
  92.           array(
  93.             str_ObjectiveInProgress,
  94.             str_ObjectiveInProgress
  95.           );
  96.  
  97.   array m_BonusMissionObjectivesStatuses =
  98.           array(
  99.             str_ObjectiveInProgress
  100.                   );
  101.  
  102.   //
  103.   //  Mission statistics
  104.  
  105.   string GetMissionStatistics()
  106.   {
  107.     return str_StatisticsTitle+German_Killed;
  108.   }
  109.   //  Mission navpoints
  110.   array GetNavPoints()
  111.   {
  112.     array navpoints =
  113.       array(
  114.         GetNavPoint("NavPoint_01"),
  115.         GetNavPoint("NavPoint_02"),
  116.         GetNavPoint("NavPoint_03")
  117.       );
  118.     return navpoints;
  119.   }
  120.   //  Mission map skin file
  121.   string GetMapSkinFileName()
  122.   {
  123.     return "Missions/Mission_12/Map.skin";
  124.   }
  125.  
  126.   int Soviet_Killed            = 0;
  127.   int German_Killed            = 0;
  128.   int Soviet_TankKilled        = 0;
  129.   final int Soviet_TankLost    = 8;
  130.   int Soviet_KatushaKilled     = 0;
  131.   final int Soviet_KatushaLost = 4;
  132.   int TraitorKilled            = 0;
  133.   final int TraitorLost        = 31;
  134.   int SupportKilled_1          = 0;
  135.   int SupportKilled_2          = 0;
  136.   final int SupportLost        = 4;
  137.  
  138.   boolean BObjective1          = false;
  139.   boolean BObjective2          = false;
  140.   boolean m_MessageOnScreen    = false;
  141.  
  142.   void OnSovietOffensiveStop()
  143.   {
  144.     BaseMission_CompleteObjective(1);
  145.     if ( !m_MessageOnScreen )
  146.      {
  147.         m_MessageOnScreen = true;
  148.         Core_SendEventTo(
  149.           "Helicopter",
  150.           "ShowEventPoint",
  151.           vector(8721.0, 7935.0, 1450), //     - id of object to show
  152.           70.0                          //     - distance from camera to object
  153.         );
  154.      }
  155.   }
  156.  
  157.   void OnGameObjectDestroyed(string _id)
  158.   {
  159.     BaseMission_OnGameObjectDestroyed(_id);
  160.     Core_BroadcastEvent( "Unit_Destroyed", _id);
  161.  
  162.     if ( Core_IsStringStartsWith( _id, "12_Soviet" ) )
  163.     {
  164.       Soviet_Killed = Soviet_Killed + 1;
  165.     }
  166.     else
  167.     {
  168.       German_Killed = German_Killed + 1;
  169.     }
  170.     if ( Core_IsStringStartsWith( _id, "12_SovietTank_" ) )
  171.     {
  172.       Soviet_TankKilled = Soviet_TankKilled + 1;
  173.  
  174.       // Sofiet Offensive under attack message
  175.       Core_BroadcastEvent(
  176.         "OnDisplayMessage",
  177.         str_AttackForcesUnderAttack,
  178.         m_BadNewsColor
  179.       );
  180.       Core_SendEventTo(
  181.           "Helicopter",
  182.           "ShowEventObject",
  183.           _id,                      //     - id of object to show
  184.           50.0                      //     - distance from camera to object
  185.         );
  186.       if ( Soviet_TankKilled >= Soviet_TankLost)
  187.       {
  188.         BaseMission_DelayedQuit();
  189.       }
  190.     }
  191.     if ( Core_IsStringStartsWith( _id, "12_GermanAA01_" ) )
  192.     {
  193.       SupportKilled_1 = SupportKilled_1 + 1;
  194.       if ( SupportKilled_1 >= SupportLost)
  195.       {
  196.         BObjective1 = true;
  197.         if ( BObjective1 && BObjective2)
  198.         {
  199.           BaseMission_CompleteBonusObjective(0);
  200.         }
  201.       }
  202.     }
  203.     if ( Core_IsStringStartsWith( _id, "12_GermanAA02_" ) )
  204.     {
  205.       SupportKilled_2 = SupportKilled_2 + 1;
  206.       if ( SupportKilled_2 >= SupportLost)
  207.       {
  208.         BObjective2 = true;
  209.         if ( BObjective1 && BObjective2)
  210.         {
  211.           BaseMission_CompleteBonusObjective(0);
  212.         }
  213.       }
  214.     }
  215.  
  216.     if ( Core_IsStringStartsWith( _id, "12_SovietKatusha_" ) )
  217.     {
  218.       Soviet_KatushaKilled = Soviet_KatushaKilled + 1;
  219.       // Soviet Offensive under attack message
  220.       Core_BroadcastEvent(
  221.         "OnDisplayMessage",
  222.         str_AttackForcesUnderAttack,
  223.         m_BadNewsColor
  224.       );
  225.       Core_SendEventTo(
  226.           "Helicopter",
  227.           "ShowEventObject",
  228.           _id,                      //     - id of object to show
  229.           50.0                      //     - distance from camera to object
  230.         );
  231.       if ( Soviet_KatushaKilled >= Soviet_KatushaLost)
  232.       {
  233.         BaseMission_DelayedQuit();
  234.       }
  235.     }
  236.     if ( Core_IsStringStartsWith( _id, "12_Traitor_" ) )
  237.     {
  238.       TraitorKilled = TraitorKilled + 1;
  239.       if ( TraitorKilled >= TraitorLost)
  240.       {
  241.         BaseMission_CompleteObjective(0);
  242.       }
  243.     }
  244.   }
  245.  
  246.   void OnMissionLoaded()
  247.   {
  248.     Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
  249.  
  250.     // Start mission music playing
  251.     Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 12);
  252.   }
  253. }
  254.